﻿using SmartPlant.Model;
using SmartPlant.Model.Biz;
using SmartPlant.Model.DbContext;
using SmartPlant.Services.Interfaces;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace SmartPlant.Services
{
    public class PanelService : BaseService, IPanelService
    {
        public async Task<List<Panel>> GetAsync(decimal ProjId, decimal plantId, panel_category_id type)
        {
            var panel = new Panel();
            var sqlwhere = $"panel_ID>0 AND eng_proj_id='0' and panel_category_id={(int)type} and plant_id={plantId}";
            var select = $"panel_id {nameof(panel.PanelId)},panel_name {nameof(panel.PanelName)}";
            var orderby = "panel_name";
            string url = $"/api/Project/{ProjId}/panel-api?sqlwhere={sqlwhere}&select={select}&orderby={orderby}";
            var res = await GetAsync<List<Panel>>(url);
            return res.data;
        }


    }
}
